<?php if (!file_exists('path/to/directory')) { /** * 0755 - Permission * true - recursive? */ mkdir('path/to/directory', 0755, true); }